package cn.topcodes.tcsf.wechat.web.controller;

import cn.topcodes.tcsf.admin.commons.api.controller.admin.AdminController;
import cn.topcodes.tcsf.admin.commons.api.domain.ApiResponseEntity;
import cn.topcodes.tcsf.wechat.domain.entity.WechatKfAccount;
import cn.topcodes.tcsf.wechat.domain.vo.WechatKfAccountVo;
import cn.topcodes.tcsf.wechat.domain.form.WechatKfAccountForm;
import cn.topcodes.tcsf.wechat.service.WechatKfAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 客服账号管理控制器
 * @author unicorn
 * @date 2017-08-17 17:48:55
 */
@Controller
@RequestMapping("/admin/wechat/kf-account")
public class WechatKfAccountController extends AdminController<WechatKfAccount,WechatKfAccountVo,WechatKfAccountForm> {

	@Autowired
	private WechatKfAccountService wechatKfAccountService;

	@Override
	protected String getPageFolder() {
		return "wechat/admin/kf-account";
	}

	@ResponseBody
	@RequestMapping(value = "sync", method = RequestMethod.POST)
	public ApiResponseEntity sync(
			@RequestParam String mpId
	) {
		this.wechatKfAccountService.syncAllKfAccount(mpId);
		return ApiResponseEntity.buildOK();
	}

}
